<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>BFC</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    p {
        color: #f55;
        background: yellow;
        width: 200px;
        line-height: 100px;
        text-align: center;
        margin: 30px;
    }

    section {
        border: 3px solid red;
        margin: 10px;
    }

    .fix-margin {
        overflow: hidden;
    }

    .left {
        width: 100px;
        height: 150px;
        float: left;
        background: rgb(139, 214, 78);
        text-align: center;
        line-height: 150px;
        font-size: 20px;
    }

    .right {
        overflow: auto;
        height: 300px;
        background: rgb(170, 54, 236);
        text-align: center;
        line-height: 300px;
        font-size: 40px;
    }

    .par {
        border: 5px solid rgb(91, 243, 30);
        width: 300px;
        overflow: scroll;
    }

    .child {
        border: 5px solid rgb(233, 250, 84);
        width: 100px;
        height: 100px;
        float: left;
    }
</style>

<body>
    <section>
        <header>
            <h1>margin重叠</h1>
        </header>
        <div>
            <p>看看我的 margin是多少</p>
            <p>看看我的 margin是多少</p>
        </div>
    </section>
    <section>
        <header>
            <h1>解决margin重叠</h1>
        </header>
        <div>
            <p>看看我的 margin是多少</p>
            <div class="fix-margin">
                <p>看看我的 margin是多少</p>
            </div>
        </div>
    </section>
    <section>
        <header>
            <h1>解决与float重叠</h1>
        </header>
        <div>
            <div class="left">LEFT</div>
            <div class="right">RIGHT</div>
        </div>
    </section>
    <section>
        <header>
            <h1>清除浮动</h1>
        </header>
        <div class="par">
            <div class="child"></div>
            <div class="child"></div>
        </div>
    </section>
</body>

</html>